package com.start.workflow.vo;

import com.alibaba.fastjson2.JSONObject;
import com.start.workflow.common.enums.StartActHandlerStatus;
import io.swagger.v3.oas.annotations.media.Schema;

import lombok.Data;

import java.time.LocalDateTime;

@Data
 @Schema(name="StartActNodeAction", description = "任务节点处理")
public class StartActNodeAction {
     @Schema(name="流程处理状态")
    private int handlerStatus;
     @Schema(name="处理人意见")
    private String handlerOpinion;
     @Schema(name="处理时间")
    private LocalDateTime createTime;

    public static StartActNodeAction create(StartActHandlerStatus status, String handlerOpinion) {
        return create(status.getValue(), handlerOpinion);
    }

    public static StartActNodeAction create(Integer status, String handlerOpinion) {
        StartActNodeAction actNodeAction = new StartActNodeAction();
        actNodeAction.setHandlerOpinion(handlerOpinion);
        actNodeAction.setHandlerStatus(status);
        actNodeAction.createTime = LocalDateTime.now();
        return actNodeAction;
    }

    public String toJSONString() {
        return JSONObject.toJSONString(this);
    }

}
